]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Leave cancelling conflicting gestures to Clutters machinery
authorJonas Dreßler <verdre@v0yd.nl>
Sun, 10 Apr 2022 22:32:06 +0000 (00:32 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 28 Aug 2025 17:14:06 +0000 (19:14 +0200)
Since everything is a gesture now in the appDisplay, ClutterGesture will
do all the cancelling of other gesture by itself now, we merely have to
describe the relationship between them.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2853>

js/ui/appDisplay.js
js/ui/dnd.js

index e09c97d6f5e521358f9ef6d4cc1d2be3e8f65dc7..b4738481ba5546f441537be064eb214e710a050e 100644 (file)
@@ -705,11 +705,6 @@ var BaseAppView = GObject.registerClass({
         if (monitor !== Main.layoutManager.primaryIndex)
             return;
 
-        if (this._dragFocus) {
-            this._dragFocus.cancelActions();
-            this._dragFocus = null;
-        }
-
         const adjustment = this._adjustment;
         adjustment.remove_transition('value');
 
@@ -932,8 +927,6 @@ var BaseAppView = GObject.registerClass({
         };
         DND.addDragMonitor(this._dragMonitor);
         this._appGridLayout.showPageIndicators();
-        this._dragFocus = null;
-        this._swipeTracker.enabled = false;
     }
 
     _onDragMotion(dragEvent) {
@@ -981,7 +974,6 @@ var BaseAppView = GObject.registerClass({
         this._resetDragPageSwitch();
 
         this._appGridLayout.hidePageIndicators();
-        this._swipeTracker.enabled = true;
     }
 
     _onDragCancelled() {
@@ -989,7 +981,6 @@ var BaseAppView = GObject.registerClass({
         // will move all items to their original positions
         this._redisplay();
         this._appGridLayout.hidePageIndicators();
-        this._swipeTracker.enabled = true;
     }
 
     _canAccept(source) {
@@ -1259,10 +1250,6 @@ var BaseAppView = GObject.registerClass({
         this._appGridLayout.goToPage(pageNumber, animate);
         this._grid.goToPage(pageNumber, animate);
     }
-
-    updateDragFocus(dragFocus) {
-        this._dragFocus = dragFocus;
-    }
 });
 
 const PageManager = GObject.registerClass({
@@ -1454,10 +1441,6 @@ class AppDisplay extends BaseAppView {
             global.settings.is_writable('app-picker-layout');
 
         this._placeholder = new AppIcon(app, {isDraggable});
-        this._placeholder.connect('notify::pressed', icon => {
-            if (icon.pressed)
-                this.updateDragFocus(icon);
-        });
         this._placeholder.scaleAndFade();
         this._redisplay();
     }
@@ -1533,10 +1516,6 @@ class AppDisplay extends BaseAppView {
                     this._redisplay();
                     this._savePages();
                 });
-                icon.connect('notify::pressed', () => {
-                    if (icon.pressed)
-                        this.updateDragFocus(icon);
-                });
             }
 
             // Don't try to display empty folders
@@ -1570,10 +1549,6 @@ class AppDisplay extends BaseAppView {
                 let app = appSys.lookup_app(appId);
 
                 icon = new AppIcon(app, {isDraggable});
-                icon.connect('notify::pressed', () => {
-                    if (icon.pressed)
-                        this.updateDragFocus(icon);
-                });
             }
 
             appIcons.push(icon);
@@ -2063,12 +2038,6 @@ class AppViewItem extends St.Button {
         return true;
     }
 
-    cancelActions() {
-        if (this._draggable)
-            this._draggable.fakeRelease();
-        this.fake_release();
-    }
-
     get id() {
         return this._id;
     }
@@ -3007,12 +2976,6 @@ export const AppIcon = GObject.registerClass({
         }
     }
 
-    _onDragBegin() {
-        if (this._menu)
-            this._menu.close(true);
-        super._onDragBegin();
-    }
-
     _createIcon(iconSize) {
         return this.app.create_icon_texture(iconSize);
     }
@@ -3044,7 +3007,6 @@ export const AppIcon = GObject.registerClass({
 
     popupMenu() {
         this.setForcedHighlight(true);
-        this.fake_release();
 
         if (!this._menu) {
             this._menu = new AppMenu(this, this._popupMenuSide, {
@@ -3180,12 +3142,6 @@ export const AppIcon = GObject.registerClass({
 
         return view?.createFolder(apps);
     }
-
-    cancelActions() {
-        if (this._menu)
-            this._menu.close(true);
-        super.cancelActions();
-    }
 });
 
 const SystemActionIcon = GObject.registerClass(
index e90b69ab1e98bb00dbeff516d8f9b478db58c695..248ebfa53350c05d10061488d351ce7f93f8b81b 100644 (file)
@@ -134,16 +134,6 @@ class _Draggable extends Signals.EventEmitter {
         this._grabbedEventSequence = null;
     }
 
-    /**
-     * Fake a release event.
-     * Must be called if you want to intercept release events on draggable
-     * actors for other purposes (for example if you're using
-     * PopupMenu.ignoreRelease())
-     */
-    fakeRelease() {
-        this._dndGesture.set_state(Clutter.GestureState.CANCELLED);
-    }
-
     _gestureRecognized() {
         const pointBeginEvent = this._dndGesture.get_point_begin_event();
         [this._dragStartX, this._dragStartY] = pointBeginEvent.get_coords();